<?php

require_once('load.php');

$seans = new Seans();
$s1 = 'sprzedaj_bilet';

if(isset($_GET) && count($_GET)){
	if(isset($_GET['rez_id']) && $_GET['rez_id']){
		$id = hexdec($_GET['rez_id']);
		if(count($sql->QueryGetFetch("select * from `rezerwacja` WHERE `id_rezerwacja`='".$id."'"))){
			$rez = $sql->QueryGetFetch("select * from `rezerwacja` WHERE `id_rezerwacja`='".$id."'");
			$rez = $rez[0];
			$s1 = 'wstep_drukuj';
			$smarty->assign("rez",$rez);
			$smarty->assign("klient",$sql->QueryGetFetch("select * from `uzytkownicy` WHERE `id`='".$rez['id_klient']."'"));
			$seansik = $sql->QueryGetFetch("select * from `seans` WHERE `id_seans`='".$rez['id_seans']."'");
			$smarty->assign("sala",$sql->QueryGetFetch("select * from `sala` WHERE `id_sala`='".$seansik[0]['id_sala']."'"));
			$smarty->assign("seans",$sql->QueryGetFetch("select * from `seans` WHERE `id_seans`='".$rez['id_seans']."'"));
			
			$smarty->assign("film",$sql->QueryGetFetch("select * from `film` WHERE `id_film`='".$seansik[0]['id_film']."'"));
			
		}else{
			$smarty->assign("komunikat","Nie znaleziono");
		}
	}
}

$smarty->display('templates/drukuj_bilet.tpl');

?>